<!DOCTYPE html>
<html>
<head>
    <title></title>
    <link rel="stylesheet" type="text/css" href="/static/layui/css/layui.css">
    <script type="text/javascript" src="/static/layui/layui.js"></script>
</head>
<body style="padding:10px;">
<form class="layui-form">
    <input type="hidden" name="id" value="{$address.id}">
    <div class="layui-form-item">
        <label class="layui-form-label">收货人</label>
        <div class="layui-input-inline">
            <input type="text" class="layui-input" name="name" value="{$address.name}" >
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">地址</label>
        <div class="layui-input-inline">
            <input type="text" class="layui-input" name="address" value="{$address.address}">
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">手机号</label>
        <div class="layui-input-inline">
            <input type="text" class="layui-input" name="mobile" value="{$address.mobile}">
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">是否默认</label>
        <div class="layui-input-inline">
            <input type="radio" name="is_default" value="1"
                   {if $address.is_default == 1}checked="checked"{/if}>是&nbsp&nbsp
            <input type="radio" name="is_default" value="0"
                   {if $address.is_default == 0}checked="checked"{/if}>否
        </div>
    </div>

</form>
<div class="layui-form-item">
    <div class="layui-input-block">
        <button class="layui-btn" onclick="save()">保存</button>
    </div>
</div>

<script type="text/javascript">
    layui.use(['layer','form'],function(){
        form = layui.form;
        layer = layui.layer;
        $ = layui.jquery;
    });
    function save(){
        $.post('/index.php/user/addredit',$('form').serialize(),function(res){
            if(res.status==0){
                layer.alert(res.message,{icon:2});
            }else{
                layer.msg(res.message);
                setTimeout(function(){parent.window.location.reload();},1000);
            }
        },'json');
    }
</script>